class Utilisateur < ActiveRecord::Base
	
	validates_presence_of :name, :password
	validates_confirmation_of :password
	validates_length_of :password, :within =>4..40
	validates_uniqueness_of :name

	def self.authenticate(name, password)
        u = find_by_name(name);
        u && u.password == password ? u: nil # && n'est pas un & logique       
end
end
